<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>时间存储完全指南</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
        }
        .serif-font {
            font-family: 'Noto Serif SC', serif;
        }
        .gradient-text {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-4px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
        }
        .time-badge {
            background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
        }
        .db-badge {
            background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
        }
        .lang-badge {
            background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
        }
        .drop-cap {
            float: left;
            font-size: 4rem;
            line-height: 1;
            font-weight: 700;
            margin-right: 0.5rem;
            margin-top: 0.25rem;
            color: #667eea;
        }
        .section-divider {
            background: linear-gradient(to right, transparent, #e5e7eb, transparent);
            height: 1px;
            margin: 3rem 0;
        }
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        .animate-fade-in {
            animation: fadeInUp 0.6s ease-out;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="relative overflow-hidden bg-gradient-to-br from-purple-900 via-purple-800 to-indigo-900 text-white">
        <div class="absolute inset-0 bg-black opacity-20"></div>
        <div class="relative container mx-auto px-6 py-24">
            <div class="max-w-4xl mx-auto text-center animate-fade-in">
                <div class="mb-6">
                    <i class="fas fa-clock text-6xl opacity-80"></i>
                </div>
                <h1 class="text-5xl md:text-6xl font-bold mb-6 serif-font">
                    时间存储完全指南
                </h1>
                <p class="text-xl md:text-2xl opacity-90 leading-relaxed">
                    深入探索数据库与编程语言中的时间处理艺术
                </p>
                <div class="mt-8 flex justify-center space-x-4">
                    <span class="inline-flex items-center px-4 py-2 bg-white bg-opacity-20 rounded-full text-sm">
                        <i class="fas fa-database mr-2"></i> 数据库时间类型
                    </span>
                    <span class="inline-flex items-center px-4 py-2 bg-white bg-opacity-20 rounded-full text-sm">
                        <i class="fas fa-code mr-2"></i> 编程语言实践
                    </span>
                </div>
            </div>
        </div>
        <div class="absolute bottom-0 left-0 right-0 h-20 bg-gradient-to-t from-gray-50 to-transparent"></div>
    </section>

    <!-- Introduction -->
    <section class="container mx-auto px-6 py-16">
        <div class="max-w-4xl mx-auto">
            <div class="bg-white rounded-2xl shadow-xl p-8 md:p-12 card-hover">
                <p class="text-lg leading-relaxed text-gray-700">
                    <span class="drop-cap serif-font">在</span>项目开发中，时间戳的存储是一个看似简单却充满细节的技术决策。无论是记录订单创建时间、用户活动日志，还是系统事件追踪，选择合适的时间存储方案直接影响着系统的性能、可维护性和国际化能力。本指南将全面解析各种时间存储方案的特点与适用场景。
                </p>
            </div>
        </div>
    </section>

    <!-- Visual Overview -->
    <section class="container mx-auto px-6 py-8">
        <div class="max-w-6xl mx-auto">
            <h2 class="text-3xl font-bold text-center mb-12 gradient-text">时间存储体系概览</h2>
            <div class="bg-white rounded-2xl shadow-xl p-8">
                <div class="mermaid">
                    graph TD
                        A[时间存储方案] --> B[SQL数据库]
                        A --> C[NoSQL数据库]
                        A --> D[编程语言]
                        
                        B --> B1[DATETIME]
                        B --> B2[TIMESTAMP]
                        B --> B3[DATE]
                        B --> B4[TIME]
                        
                        C --> C1[ISO 8601字符串]
                        C --> C2[Unix时间戳]
                        
                        D --> D1[Java时间API]
                        D --> D2[Python datetime]
                        
                        D1 --> D11[LocalDateTime]
                        D1 --> D12[Instant]
                        D1 --> D13[Date/Calendar]
                        
                        D2 --> D21[datetime.datetime]
                        D2 --> D22[time.time]
                        
                        style A fill:#667eea,stroke:#fff,color:#fff
                        style B fill:#4facfe,stroke:#fff,color:#fff
                        style C fill:#00f2fe,stroke:#fff,color:#fff
                        style D fill:#fa709a,stroke:#fff,color:#fff
                </div>
            </div>
        </div>
    </section>

    <!-- SQL Database Section -->
    <section class="container mx-auto px-6 py-16">
        <div class="max-w-6xl mx-auto">
            <div class="flex items-center mb-12">
                <div class="db-badge text-white px-6 py-3 rounded-full mr-4">
                    <i class="fas fa-database text-2xl"></i>
                </div>
                <h2 class="text-4xl font-bold text-gray-800 serif-font">SQL 数据库时间存储</h2>
            </div>

            <div class="grid md:grid-cols-2 gap-8">
                <!-- DATETIME Card -->
                <div class="bg-white rounded-xl shadow-lg overflow-hidden card-hover">
                    <div class="bg-gradient-to-r from-blue-500 to-blue-600 p-6 text-white">
                        <h3 class="text-2xl font-bold flex items-center">
                            <i class="fas fa-calendar-alt mr-3"></i> DATETIME
                        </h3>
                    </div>
                    <div class="p-6">
                        <div class="mb-4">
                            <span class="inline-block bg-blue-100 text-blue-800 px-3 py-1 rounded-full text-sm font-medium">
                                格式示例：2024-08-15 12:34:56
                            </span>
                        </div>
                        <p class="text-gray-700 mb-4">存储日期和时间的完整信息，精确到秒。不受时区影响，存储的是字面值。</p>
                        <div class="border-t pt-4">
                            <h4 class="font-semibold text-gray-800 mb-2">
                                <i class="fas fa-check-circle text-green-500 mr-2"></i>适用场景
                            </h4>
                            <ul class="space-y-2 text-gray-600">
                                <li><i class="fas fa-shopping-cart text-gray-400 mr-2"></i>订单创建时间</li>
                                <li><i class="fas fa-user-plus text-gray-400 mr-2"></i>用户注册时间</li>
                                <li><i class="fas fa-file-alt text-gray-400 mr-2"></i>内容发布时间</li>
                            </ul>
                        </div>
                    </div>
                </div>

                <!-- TIMESTAMP Card -->
                <div class="bg-white rounded-xl shadow-lg overflow-hidden card-hover">
                    <div class="bg-gradient-to-r from-purple-500 to-purple-600 p-6 text-white">
                        <h3 class="text-2xl font-bold flex items-center">
                            <i class="fas fa-clock mr-3"></i> TIMESTAMP
                        </h3>
                    </div>
                    <div class="p-6">
                        <div class="mb-4">
                            <span class="inline-block bg-purple-100 text-purple-800 px-3 py-1 rounded-full text-sm font-medium">
                                自动时区转换
                            </span>
                        </div>
                        <p class="text-gray-700 mb-4">存储时间戳，通常会自动处理时区转换。在MySQL中有自动更新特性。</p>
                        <div class="border-t pt-4">
                            <h4 class="font-semibold text-gray-800 mb-2">
                                <i class="fas fa-check-circle text-green-500 mr-2"></i>适用场景
                            </h4>
                            <ul class="space-y-2 text-gray-600">
                                <li><i class="fas fa-sync text-gray-400 mr-2"></i>记录最后更新时间</li>
                                <li><i class="fas fa-globe text-gray-400 mr-2"></i>跨时区应用</li>
                                <li><i class="fas fa-history text-gray-400 mr-2"></i>审计日志</li>
                            </ul>
                        </div>
                    </div>
                </div>

                <!-- DATE Card -->
                <div class="bg-white rounded-xl shadow-lg overflow-hidden card-hover">
                    <div class="bg-gradient-to-r from-green-500 to-green-600 p-6 text-white">
                        <h3 class="text-2xl font-bold flex items-center">
                            <i class="fas fa-calendar mr-3"></i> DATE
                        </h3>
                    </div>
                    <div class="p-6">
                        <div class="mb-4">
                            <span class="inline-block bg-green-100 text-green-800 px-3 py-1 rounded-full text-sm font-medium">
                                格式示例：2024-08-15
                            </span>
                        </div>
                        <p class="text-gray-700 mb-4">仅存储日期部分，不包含时间信息。占用存储空间小。</p>
                        <div class="border-t pt-4">
                            <h4 class="font-semibold text-gray-800 mb-2">
                                <i class="fas fa-check-circle text-green-500 mr-2"></i>适用场景
                            </h4>
                            <ul class="space-y-2 text-gray-600">
                                <li><i class="fas fa-birthday-cake text-gray-400 mr-2"></i>出生日期</li>
                                <li><i class="fas fa-calendar-check text-gray-400 mr-2"></i>到期日期</li>
                                <li><i class="fas fa-chart-line text-gray-400 mr-2"></i>统计报表日期</li>
                            </ul>
                        </div>
                    </div>
                </div>

                <!-- TIME Card -->
                <div class="bg-white rounded-xl shadow-lg overflow-hidden card-hover">
                    <div class="bg-gradient-to-r from-orange-500 to-orange-600 p-6 text-white">
                        <h3 class="text-2xl font-bold flex items-center">
                            <i class="fas fa-hourglass-half mr-3"></i> TIME
                        </h3>
                    </div>
                    <div class="p-6">
                        <div class="mb-4">
                            <span class="inline-block bg-orange-100 text-orange-800 px-3 py-1 rounded-full text-sm font-medium">
                                格式示例：12:34:56
                            </span>
                        </div>
                        <p class="text-gray-700 mb-4">仅存储时间部分，不包含日期信息。适合记录每日重复的时间点。</p>
                        <div class="border-t pt-4">
                            <h4 class="font-semibold text-gray-800 mb-2">
                                <i class="fas fa-check-circle text-green-500 mr-2"></i>适用场景
                            </h4>
                            <ul class="space-y-2 text-gray-600">
                                <li><i class="fas fa-business-time text-gray-400 mr-2"></i>营业时间</li>
                                <li><i class="fas fa-bell text-gray-400 mr-2"></i>定时任务执行时间</li>
                                <li><i class="fas fa-stopwatch text-gray-400 mr-2"></i>持续时长</li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <div class="section-divider"></div>

    <!-- NoSQL Database Section -->
    <section class="container mx-auto px-6 py-16">
        <div